//
//  MyInvestViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/16.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "MyInvestViewController.h"
#import "MyInvestView.h"
#import "MoneyRecordViewController.h"//资金记录
#import "BorrowViewController.h"//我的借款
#import "DebtViewController.h"//债权转让
#import "MyTouziViewController.h"//我要投资

@interface MyInvestViewController ()

@end

@implementation MyInvestViewController
#define TOPTITLE
-(NSArray<NSString *> *)titles {
    
    
    switch (self.num) {
        case 0:
            return @[@"全部",@"投资中",@"已结清",@"赎回中",@"已赎回"];
            break;
        case 1:
            return @[@"全部",@"招标中",@"还款中",@"已还完"];
            break;
        case 4:
            return @[@"全部",@"还款中",@"已还完"];
            break;
        case 5:
             return @[@"可转让",@"转让中",@"已转让",@"承接债权"];
            break;
        case 6:
            return @[@"充值记录",@"提现记录",@"投资记录",@"放款记录"];
            break;
        default:
            break;
    }
    return nil;
}

-(instancetype)init{
    
    if (self = [super init]) {
        
        self.menuViewStyle = WMMenuViewStyleLine;
        self.titleSizeNormal = 14;
        self.titleSizeSelected = 16.0;
        
        if (self.num == 5 || self.num == 6) {
            self.menuItemWidth = Screen_Width/4;
        }else if (self.num == 0){
            self.menuItemWidth = 80;
        }
        self.menuItemWidth = 80;
        self.menuHeight = 40;
    }
    return self;
    
}


#pragma mark --实现WMPageControllerDataSource
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titles.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titles[index];
    
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    switch (self.num) {
        case 0:
            self.title = @"我的投资";
            break;
        case 1:
            self.title = @"我的借款";
            break;
        case 4:
            self.title = @"我要还款";
            break;
        case 5:
            self.title = @"债权转让";
            break;
        case 6:
            self.title = @"资金记录";
            break;
        default:
            break;
    }
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    
    
    //大于7.0版本设置
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        self.extendedLayoutIncludesOpaqueBars = NO;
        self.modalPresentationCapturesStatusBarAppearance = NO;
    }
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    
    //资金记录
    if (self.num == 6) {
        MoneyRecordViewController *moneyView = [[MoneyRecordViewController alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        moneyView.index = index;
        return moneyView;
    }else if(self.num == 1){
        BorrowViewController *borrowView = [[BorrowViewController alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        borrowView.index = index;
        return borrowView;
    }else if (self.num == 5){
        DebtViewController *debtView = [[DebtViewController alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        debtView.index = index;
        return debtView;
    }else if (self.num == 0){
        
        MyTouziViewController *investView = [[MyTouziViewController alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        investView.index = index;
        return investView;
    }
    else {
        MyInvestView *investView= [[MyInvestView alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        investView.index = index;
        return investView;
    }
  
}


@end
